package hk.linkcredit.walletservice.wallet.mapper;

import hk.linkcredit.walletservice.wallet.domain.entity.WalletFlow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import hk.linkcredit.walletservice.wallet.domain.vo.WalletExpend;
import hk.linkcredit.walletservice.wallet.domain.vo.WalletIncome;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 钱包流水表 Mapper 接口
 * </p>
 *
 * @author LinkCredit
 * @since 2022-06-10 15:18:10
 */
public interface WalletFlowMapper extends BaseMapper<WalletFlow> {

    List<WalletIncome> getWalletIncome(@Param("custNo") String custNo, @Param("flowType") String flowType);

    List<WalletExpend> getWalletExpend(String custNo);

    @Select("select sum(change_amount) from wallet_flow t where t.funds_type=#{flowType} and t.cust_no=#{custNo} and t.state=1;")
    BigDecimal getSumAmountByFoundsType(@Param("custNo") String custNo,@Param("flowType") String flowType);

}
